//
//  tongZhiTableViewCell.swift
//  AreaChainblock
//
//  Created by 赵佟越 on 2018/11/5.
//  Copyright © 2018年 zhaotongyue. All rights reserved.
//

import UIKit

class tongZhiTableViewCell: UITableViewCell {
    
    @IBOutlet weak var bottomLabel: UILabel!
    
    @IBOutlet weak var mySeeMoreLabel: UILabel!
    @IBOutlet weak var timeLabel: UILabel!
    @IBOutlet weak var topLabel: UILabel!
    private var myModel:productModel? = productModel()
    
    var model :productModel{
        set {
            myModel = newValue;
            mySeeMoreLabel.text = XALanguageManager.getString(key: "查看详情")
            if XALanguageManager.getString(key: "语种") == "English" {
                bottomLabel.text = myModel?.e_description! as! String
                timeLabel.text = myModel?.add_time! as! String
                if myModel?.is_read == "0" {
                    let attrMStr = NSMutableAttributedString()
                    let attacmentM_baozhi = NSTextAttachment()
                    attacmentM_baozhi.image = UIImage(named: "dian")
                    attacmentM_baozhi.bounds = CGRect(x: 5, y: 0, width: 12, height: 12)
                    
                    var attrMStrbaozhi : NSAttributedString = NSAttributedString(string: "")
                    
                    
                    attrMStrbaozhi = NSAttributedString(string: String(format:"    %@",(myModel?.e_title)!))
                    let attacmentM_baozhi2 = NSAttributedString(attachment: attacmentM_baozhi)
                    attrMStr.append(attacmentM_baozhi2)
                    attrMStr.append(attrMStrbaozhi)
                    
                    
                    topLabel.attributedText = attrMStr;
                    //topLabel.text = myModel?.title
                }else{
                    topLabel.text = myModel?.e_title
                }
            }else {
                bottomLabel.text = myModel?.mydescription! as! String
                timeLabel.text = myModel?.add_time! as! String
                if myModel?.is_read == "0" {
                    let attrMStr = NSMutableAttributedString()
                    let attacmentM_baozhi = NSTextAttachment()
                    attacmentM_baozhi.image = UIImage(named: "dian")
                    attacmentM_baozhi.bounds = CGRect(x: 5, y: 0, width: 12, height: 12)
                    
                    var attrMStrbaozhi : NSAttributedString = NSAttributedString(string: "")
                    
                    
                    attrMStrbaozhi = NSAttributedString(string: String(format:"    %@",(myModel?.title)!))
                    let attacmentM_baozhi2 = NSAttributedString(attachment: attacmentM_baozhi)
                    attrMStr.append(attacmentM_baozhi2)
                    attrMStr.append(attrMStrbaozhi)
                    
                    
                    topLabel.attributedText = attrMStr;
                    //topLabel.text = myModel?.title
                }else{
                    topLabel.text = myModel?.title
                }
            }
            
           
            
            
        }
        get
        {
            return (self.myModel)!
            
        }
    }

    override func awakeFromNib() {
        super.awakeFromNib()
        bottomLabel.snp.makeConstraints { (make) in
            make.top.equalTo(self.topLabel.snp.bottom).offset(10)
        }
        bottomLabel.font = UIFont.systemFont(ofSize: 13)
        bottomLabel.numberOfLines = 1
        
        timeLabel.font = UIFont.systemFont(ofSize: 13)
        topLabel.font = UIFont.boldSystemFont(ofSize: 17)
        
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        
        
        
        // Configure the view for the selected state
    }
    
}
